package day240816;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

public class Demo {
    public static void main(String[] args) {
        //集合转数组
        /*Collection<String> list = new ArrayList<>();
        list.add("one");
        list.add("two");
        list.add("three");
        list.add("four");
        list.add("five");
        String[] strs = list.toArray(new String[list.size()]);
        for(String l :list){
            System.out.println(l);
        }
        System.out.println(list);
        for(String str : strs){
            System.out.println(str);
        }
        System.out.println(Arrays.toString(strs));*/
        //数组转集合
        /*Integer[] integers = {1,2,3,5,7};
        System.out.println(Arrays.toString(integers));
        List<Integer> list = Arrays.asList(integers);
        System.out.println(list);

        integers[1]=20;
        System.out.println("数组改变后：");
        System.out.println(Arrays.toString(integers));
        System.out.println("list"+list);
        list.set(2,30);
        System.out.println("集合改变后：");
        System.out.println(Arrays.toString(integers));
        System.out.println("list"+list);

        //list.add(new Integer(12));//(UnsupportedOperationException)*/




    }
}
